<?php
#region CODE
use Gotcha\App\Framework\Controller;

$framework = new Controller();
$reservations = new \Modules\JasminumReservations\Controllers\AdminController();
#endregion
?>
<div id="adminPanel">
    <header>
        <h1>Panel Administracyjny</h1>
    </header>
    <div id="adminContent" class="clearfix">
        <div id="adminNavigation" class="pull-left">
            <ul>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/StaticContent"); ?>">Treści statyczne</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Layout"); ?>">Układ stron</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Modules"); ?>">Moduły</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Settings"); ?>">Ustawienia</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Jasminum/Calendar"); ?>">Kalendarz</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Jasminum/Gallery"); ?>">Galeria</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Jasminum/Reservations"); ?>">Rezerwacje</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Jasminum/Menus"); ?>">Menu</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Jasminum/Newsletter"); ?>">Newsletter</a>
                </li>
                <li>
                    <a href="<?= $framework->UrlContent("/Admin/Jasminum/News"); ?>">Newsy</a>
                </li>
            </ul>
        </div>
        <div id="adminPage" class="pull-left" style="margin: 8px;">
            <header>
                <h2>Rezerwacje - Edytuj</h2>
            </header>
            <div id="notification">
                <?php if(isset($_GET['error'])): ?>
                    <div class="error">Musisz wypełnić wszystkie pola</div>
                <?php endif; ?>
            </div>
            <?php if(!empty($_GET['id'])): ?>
            <div id="adminStaticContent">
                <form method="post" action="<?= $framework->UrlContent("/Admin/Jasminum/Reservations/EditPost"); ?>">
                    <fieldset>
                        <label for="Firstname">Imię</label>
                        <input type="text" name="Firstname" id="Firstname" value="<?= $reservations->returnReservation($_GET['id'])->getFirstname(); ?>">
                        <label for="Lastname">Nazwisko</label>
                        <input type="text" name="Lastname" id="Lastname" value="<?= $reservations->returnReservation($_GET['id'])->getLastname(); ?>">
                        <label for="Email">Email</label>
                        <input type="text" name="Email" id="Email" value="<?= $reservations->returnReservation($_GET['id'])->getEmail(); ?>">
                        <label for="DateFrom">Data od</label>
                        <input type="text" name="DateFrom" id="DateFrom" value="<?= $reservations->returnReservation($_GET['id'])->getDateFrom(); ?>">
                        <label for="DateTo">Data do</label>
                        <input type="text" name="DateTo" id="DateTo" value="<?= $reservations->returnReservation($_GET['id'])->getDataTo(); ?>">
                        <label for="Phone">Telefon</label>
                        <input type="text" name="Phone" id="Phone" value="<?= $reservations->returnReservation($_GET['id'])->getPhone(); ?>">
                        <label for="RoomColor">Kolor pokoju</label>
                        <input type="text" name="RoomColor" id="RoomColor" value="<?= $reservations->returnReservation($_GET['id'])->getRoomColor(); ?>">
                        <label for="RoomType">Typ pokoju</label>
                        <input type="text" name="RoomType" id="RoomType" value="<?= $reservations->returnReservation($_GET['id'])->getRoomType(); ?>">
                        <button type="submit">Zapisz</button>
                        <input type="hidden" name="Id" value="<?= $_GET['id']; ?>">
                    </fieldset>
                </form>
            </div>
            <?php endif; ?>
        </div>
    </div>
</div>